/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Infraccion")
@NamedQueries({
    @NamedQuery(name = "Infraccion.findAll", query = "SELECT i FROM Infraccion i"),
    @NamedQuery(name = "Infraccion.findByIdInfraccion", query = "SELECT i FROM Infraccion i WHERE i.idInfraccion = :idInfraccion"),
    @NamedQuery(name = "Infraccion.findByMotivo", query = "SELECT i FROM Infraccion i WHERE i.motivo = :motivo"),
    @NamedQuery(name = "Infraccion.findByFechaReg", query = "SELECT i FROM Infraccion i WHERE i.fechaReg = :fechaReg"),
    @NamedQuery(name = "Infraccion.findByMonto", query = "SELECT i FROM Infraccion i WHERE i.monto = :monto"),
    @NamedQuery(name = "Infraccion.findByEstado", query = "SELECT i FROM Infraccion i WHERE i.estado = :estado")})
public class Infraccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdInfraccion")
    private Integer idInfraccion;
    @Size(max = 200)
    @Column(name = "Motivo")
    private String motivo;
    @Column(name = "FechaReg")
    @Temporal(TemporalType.DATE)
    private Date fechaReg;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "Monto")
    private Double monto;
    @Column(name = "Estado")
    private Integer estado;
    @JoinColumn(name = "IdPersonal", referencedColumnName = "IdPersonal")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Personal idPersonal;
    @JoinColumn(name = "IdTipoInfraccion", referencedColumnName = "IdTipoInfraccion")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private TipoInfraccion idTipoInfraccion;
    @JoinColumn(name = "IdPrestamo", referencedColumnName = "IdPrestamo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Prestamo idPrestamo;
    @JoinColumn(name = "IdUsuario", referencedColumnName = "IdUsuario")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private UsuarioBiblioteca idUsuario;

    public Infraccion() {
    }

    public Infraccion(Integer idInfraccion) {
        this.idInfraccion = idInfraccion;
    }

    public Integer getIdInfraccion() {
        return idInfraccion;
    }

    public void setIdInfraccion(Integer idInfraccion) {
        this.idInfraccion = idInfraccion;
    }

    public String getMotivo() {
        return motivo;
    }

    public void setMotivo(String motivo) {
        this.motivo = motivo;
    }

    public Date getFechaReg() {
        return fechaReg;
    }

    public void setFechaReg(Date fechaReg) {
        this.fechaReg = fechaReg;
    }

    public Double getMonto() {
        return monto;
    }

    public void setMonto(Double monto) {
        this.monto = monto;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public Personal getIdPersonal() {
        return idPersonal;
    }

    public void setIdPersonal(Personal idPersonal) {
        this.idPersonal = idPersonal;
    }

    public TipoInfraccion getIdTipoInfraccion() {
        return idTipoInfraccion;
    }

    public void setIdTipoInfraccion(TipoInfraccion idTipoInfraccion) {
        this.idTipoInfraccion = idTipoInfraccion;
    }

    public Prestamo getIdPrestamo() {
        return idPrestamo;
    }

    public void setIdPrestamo(Prestamo idPrestamo) {
        this.idPrestamo = idPrestamo;
    }

    public UsuarioBiblioteca getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(UsuarioBiblioteca idUsuario) {
        this.idUsuario = idUsuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInfraccion != null ? idInfraccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Infraccion)) {
            return false;
        }
        Infraccion other = (Infraccion) object;
        if ((this.idInfraccion == null && other.idInfraccion != null) || (this.idInfraccion != null && !this.idInfraccion.equals(other.idInfraccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Infraccion[ idInfraccion=" + idInfraccion + " ]";
    }
    
}
